// ChatCompletionResponse.java
package com.icost.directive.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChatCompletionResponse {

    private List<Choice> choices;
    private long created;
    private String id;
    private String model;

    @JsonProperty("service_tier")
    private String serviceTier;

    @JsonProperty("object")
    private String objectType;

    private Usage usage;

    /** 便捷方法：获取第一条 assistant 文本内容 */
    public String getFirstMessageContent() {
        if (choices == null || choices.isEmpty()
                || choices.get(0).getMessage() == null) {
            return null;
        }
        return choices.get(0).getMessage().getContent();
    }
}
